<!-- 抽奖页面 lottery 2015-07-15 -->
<?php $this->load->view('home/layout/header') ?>
    <div class="lottery widthMax">
        <header class="lotteryHead am-cf">
            <div class="return am-fl"><a href="javascript:goHistoryBack('<?php echo site_url();?>')"><i class="iconfont icon-zuojiantou"></i></a></div>
            <div class="title am-fl">幸运大抽奖</div>
        </header>
        <div class="describe">
            <img src="/skins/home/images/lottery01.jpg" />
            <div class="txt">
                <p>幸运大转盘是由本公司提供技术支持，平台或商家创建抽奖活动，为用户提供幸运抽奖服务的活动平台，用户每天可通过关注本通道或登录平台的幸运大转盘活动页面参与抽奖活动。</p>
                <p><i>注</i>以下系列抽奖活动均由平台或各商家创建，其奖品的真实性由活动创建单位自行负责，具体请参考活动详情。</p>
            </div>
        </div>
        <div class="lotteryList">
            <div class="title">
                <span>抽奖活动列表</span>
                <i class="search iconfont">&#xe668;</i>
            </div>
            <ul class="drawList am-cf">
                <?php if ( $activity_lottery->num_rows() > 0 ): ?>
                    <?php foreach ($activity_lottery->result() as $key => $val ): ?>
                        <?php if ( $val->sort != 0 ): ?>
                        <li>
                            <a href="<?php echo $this->config->sales_url, 'm/weeksales/grid.html?id=', $val->lottery_id; ?>">
                                <div class="drawname flex">
                                    <div class="drawLeft <?php echo 'type' . ( ($val->sort % 5) ? ($val->sort % 5) : '5' );?>">
                                        <span>编号</span>
                                        <p><?php echo $val->lottery_id;?></p>
                                    </div>
                                    <div class="drawRight flex-1">
                                        <p><?php echo $val->lottery_name;?></p>
                                        <span>已中奖人数：<em><?php echo $val->winners_total;?></em></span>
                                        <i>已抽奖人数：<?php echo $val->user_total;?></i>
                                    </div>
                                </div>
                                <div class="godraw am-cf">
                                    <?php $start_date = time();?>
                                    <?php $end_date = strtotime($val->end_date);?>
                                    <?php $time = (int)$end_date - (int)$start_date;?>
                                    <?php if ( $time > 0 ): ?>
                                        <?php $day = floor($time/60/60/24); if ($day <= 9) $day = '0' . $day;?>
                                        <?php $hour = floor($time/60/60%24); if ($hour <= 9) $hour = '0' . $hour;?>
                                        <?php $minute = floor($time/60%60); if ($minute <= 9) $minute = '0' . $minute;?>
                                        <?php $second = floor($time%60); if ($second <= 9) $second = '0' . $second;?>
                                        <div class="time">
                                            <span data-count="<?php echo $activity_lottery->num_rows();?>" >距结束</span>
                                            <div data-id ="<?php echo 'id' . $val->lottery_id;?>" data-end-time ="<?php echo date('Y/m/d H:i:s',strtotime($val->end_date));?>" class="countdown am-fl <?php echo 'downList'.($key+1);?>" id="<?php echo 'id' . $val->lottery_id;?>">
                                                <i class="day"><?php echo $day?></i><em>天</em>
                                                <i class="hour"><?php echo $hour;?></i><em>时</em>
                                                <i class="minute"><?php echo $minute;?></i><em>分</em>
                                                <i class="second"><?php echo $second;?></i><em>秒</em>
                                            </div>
                                        </div>
                                        <div class="chouj">去抽奖<i class="iconfont">&#xe673;</i></div>
                                    <?php else:?>
                                        你来晚了，抽奖活动已结束！
                                    <?php endif ?>
                                </div>
                            </a>
                        </li>
                        <?php endif ?>
                    <?php endforeach ?>
                <?php endif ?>
            </ul>
        </div>
    </div>
    <div class="lotterySearch widthMax">
        <div class="head am-cf">
            <div class="return am-fl"><i class="iconfont icon-zuojiantou"></i></div>
            <div class="searchBox am-fl">
                <input type="text" placeholder="请输入抽奖名称或编号" name="keyword">
            </div>
            <div class="cancel am-fl">取消</div>
        </div>
        <div class="lotteryList searchlist">
            <ul class="drawList drawList1 am-cf">
            </ul>
        </div>
    </div>
<?php $this->load->view('home/layout/footer') ?>